/*
 * @Author: w_yy
 * @Date: 2023-03-17 14:03:02
 * @LastEditors: w_yy
 * @LastEditTime: 2023-03-21 10:33:32
 * @FilePath: \vue-project\src\main.js
 * @Copyright: 2023 沈阳东软智睿放疗技术有限公司
 * @Descripttion: 该文件用于OIS系统。版权由东软智睿放疗技术有限公司所有
 */
import { createApp } from "vue";
import { createPinia } from "pinia";
import "ant-design-vue/dist/antd.css";
import { setupPermissionDirective } from "./directives/premission";
import axios from "axios";
// import m1 from "./glob/m1.json";
// console.log(m1);
// const modules = import.meta.glob("./glob/*");
const modules = import.meta.globEager("./glob/*");
// console.log(modules);

// Object.entries(modules).forEach(([key, value]) => {
//   //   console.log(key, value);
//   value().then((modules) => {
//     console.log(key, modules.default);
//   });
// });
console.log(import.meta.env.BASE_URL);

Object.entries(modules).forEach(([key, value]) => {
  // console.log(key, value.default);
});
//axios 请求

// axios.get("/api/server").then((_d) => {
//   console.log(_d.data);
// });

import App from "./App.vue";
// import { Test } from "./App.jsx";
import router from "./router";

import "./assets/main.css";

const app = createApp(App);
setupPermissionDirective(app);
//自定义指令权限
// let usersPermissions = ["user"];
// app.directive("hasPermission", {
//   mounted(el, binding, vnode) {
//     const { value } = binding;
//     let f = usersPermissions.some((p) => {
//       return p.indexOf(value) !== -1;
//     });
//     if (!f) {
//       el.parentNode && el.parentNode.removeChild(el);
//     }
//   },
// });

// const app = createApp(Test);
app.use(createPinia());
app.use(router);

app.mount("#app");
